﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using WatiNSahi;

using WatiNSahi.Extensions;

using WatiN.Core;
using WatiN.Core.Native;
using WatiN.Core.Logging;
using WatiN.Core.UtilityClasses;
using WatiN.Core.Properties;
using WatiN.Core.Native.Windows;
using WatiN.Core.DialogHandlers;

namespace WatiNSahiTester
{
    class WatiNSahiGoogleTests : WatiNSahiTest
    {
        


        public void _find_in_google()
        {
            string searchTerm = "WatiN Web Automation";

            string expectedUrl = "http://watin.org";
            
            //WatiN.Extensions.ExtensionsSettings.DefaultBrowser = BrowserType.FireFox;
            
            _navigateTo("http://www.google.co.in");

            _wait_for_complete();           

            _setValue(_textbox("q"), searchTerm);

            _click_no_wait(_submit("Google Search"));

            _click(_button("btnG"));

            _wait_for_complete(120);            

            var result = _containsText(expectedUrl);

            _log(string.Format("Got result value as :: '{0}'",result));

            _click(_link("WatiN"));

            _wait_for_complete(140);

            _close();
    
        }
        
    }
}
